<?php

namespace App\Trip\Plane\Rules\Interfaces;

use Illuminate\Contracts\Support\Arrayable;

abstract class  Rules implements ChangeRulesInterface, RefundRulesInterface, LuggageRuleInterface, Arrayable
{
    public function toArray(): array
    {
        return [
            'modify'  => $this->canModify(),
            'change'  => $this->getChange(),
            'refund'  => $this->getRefund(),
            'luggage' => $this->getLuggage(),
        ];
    }

    public function getChange(): array
    {
        return [
            'rules'          => $this->getChangeRules(),
            'description'    => $this->getChangeRuleDescription(),
            'description_uy' => $this->getChangeRuleDescriptionUy(),
        ];
    }

    public function getRefund(): array
    {
        return [
            'rules'          => $this->getRefundRules(),
            'description'    => $this->getRefundRuleDescription(),
            'description_uy' => $this->getRefundRuleDescriptionUy(),
        ];
    }

    public function getLuggage(): array
    {
        return [
            'rules'          => $this->getLuggageDetails(),
            'description'    => $this->getLuggageRemark(),
            'description_uy' => $this->getLuggageRemarkUy(),
        ];
    }

    public function getModify(): array
    {
        return [
            'modify'         => $this->canModify(),
            'description'    => $this->getModifyDescription(),
            'description_uy' => $this->getModifyDescriptionUy(),
        ];
    }

    public function getModifyDescription(): string
    {
        return $this->canModify() ? '可转签' : '不可转签';
    }

    public function getModifyDescriptionUy(): string
    {
        return __($this->getModifyDescription());
    }
}